﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

namespace NumericTextBox
{
    public class AttachedProperties
    {
        #region IsUsingMinMaxValue
        public static void SetIsUsingMinMaxValue(UIElement d, bool newValue)
        {
            d.SetValue(AttachedProperties.IsUsingMinMaxValueProperty, newValue);
        }

        public static bool GetIsUsingMinMaxValue(UIElement d)
        {
            return (bool)d.GetValue(AttachedProperties.IsUsingMinMaxValueProperty);
        }

        // Using a DependencyProperty as the backing store for IsUsingMinMaxValue.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty IsUsingMinMaxValueProperty =
            DependencyProperty.RegisterAttached("IsUsingMinMaxValue", typeof(bool), typeof(AttachedProperties), new PropertyMetadata(false)); 
        #endregion

        #region MinimumValue
        public static void SetMinimumValue(UIElement d, int newValue)
        {
            d.SetValue(AttachedProperties.MinimumValueProperty, newValue);
        }

        public static int GetMinimumValue(UIElement d)
        {
            return (int)d.GetValue(AttachedProperties.MinimumValueProperty);
        }

        // Using a DependencyProperty as the backing store for MinimumValue.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty MinimumValueProperty =
            DependencyProperty.RegisterAttached("MinimumValue", typeof(int), typeof(AttachedProperties), new FrameworkPropertyMetadata(0)); 
        #endregion

        #region MaximumValue
        public static void SetMaximumValue(UIElement d, int newValue)
        {
            d.SetValue(AttachedProperties.MaximumValueProperty, newValue);
        }

        public static int GetMaximumValue(UIElement d)
        {
            return (int)d.GetValue(AttachedProperties.MaximumValueProperty);
        }

        // Using a DependencyProperty as the backing store for MinimumValue.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty MaximumValueProperty =
            DependencyProperty.RegisterAttached("MaximumValue", typeof(int), typeof(AttachedProperties), new FrameworkPropertyMetadata(0)); 
        #endregion
    }
}
